<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Category_id')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-category_id" data-rule="required" min="0" data-source="goods/category/index" class="form-control selectpage" name="row[category_id]" type="text" value="{$row.category_id|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text" value="{$row.title|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Description')}:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-description" class="form-control" data-rule="required" rows="5" name="row[description]" cols="50">{$row.description}</textarea>
        </div>
    </div>
    
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('商品详情')}:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-content" class="form-control editor" data-rule="required" rows="5" name="row[content]" cols="50">{$row.content}</textarea>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Cover_image')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-cover_image" data-rule="required" class="form-control" size="50" name="row[cover_image]" type="text" value="{$row.cover_image|htmlentities}">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="faupload-cover_image" class="btn btn-danger faupload" data-input-id="c-cover_image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-cover_image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-cover_image" class="btn btn-primary fachoose" data-input-id="c-cover_image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-cover_image"></span>
            </div>
            <ul class="row list-inline faupload-preview" id="p-cover_image"></ul>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Images')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-images" class="form-control" data-rule="required" size="50" name="row[images]" type="textarea" value="{$row.images|htmlentities}">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-images"></span>
            </div>
            <ul class="row list-inline faupload-preview" id="p-images"></ul>
        </div>
    </div>
    <!-- <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Sales')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-sales" data-rule="required" class="form-control" name="row[sales]" type="number" value="{$row.sales|htmlentities}">
        </div>
    </div> -->
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('运费')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-freight_price" class="form-control" data-rule="required" name="row[freight_price]" type="number" value="{$row.freight_price}" min="0" step="0.01">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
        <div class="col-xs-12 col-sm-8">
            
            <div class="radio">
            {foreach name="statusList" item="vo"}
            <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label> 
            {/foreach}
            </div>

        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('规格列表')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="table-responsive">
                <table class="table table-striped">
                    <thead>
                        <tr>
                            <th>{:__('规格名称')}</th>
                            <th>{:__('售价')}</th>
                            <th>{:__('原价')}</th>
                            <th>{:__('库存')}</th>
                            <th>{:__('操作')}</th>
                        </tr>
                    </thead>
                    <tbody id="spec-table">
                        {foreach name="row.specList" item="vo" key="i"}
                        <tr>
                            <td>
                                <input type="hidden" name="row[specList][{$i}][id]" class="form-control" value="{$vo.id}" />
                                <input type="text" name="row[specList][{$i}][spec_name]" class="form-control" value="{$vo.spec_name}" data-rule="required" />
                            </td>
                            <td>
                                <input type="number" name="row[specList][{$i}][price]" class="form-control" value="{$vo.price}" min="0" step="0.01" data-rule="required" />
                            </td>
                            <td>
                                <input type="number" name="row[specList][{$i}][original_price]" class="form-control" value="{$vo.original_price}" min="0" step="0.01" data-rule="required" />
                            </td>
                            <td>
                                <input type="number" name="row[specList][{$i}][stock]" class="form-control" value="{$vo.stock}" min="0" data-rule="required" />
                            </td>
                            <td>
                                <a href="javascript:;" class="btn btn-xs btn-danger btn-delone"><i class="fa fa-times"></i></a>
                            </td>
                        </tr>
                        {/foreach}
                    </tbody>
                    <tfoot>
                        <tr>
                            <td colspan="5">
                                <a href="javascript:;" class="btn btn-success btn-add-spec">
                                    <i class="fa fa-plus"></i> {:__('添加规格')}
                                </a>
                            </td>
                        </tr>
                    </tfoot>
                </table>
            </div>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('权重')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-weigh" data-rule="required" class="form-control" name="row[weigh]" type="number" value="{$row.weigh|htmlentities}">
        </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
        </div>
    </div>
</form>
<script id="spec-template" type="text/html">
    <tr>
        <td>
            <input type="text" name="row[specList][<%=index%>][spec_name]" class="form-control" data-rule="required" />
        </td>
        <td>
            <input type="number" name="row[specList][<%=index%>][price]" class="form-control" value="0.00" min="0" step="0.01" data-rule="required" />
        </td>
        <td>
            <input type="number" name="row[specList][<%=index%>][original_price]" class="form-control" value="0.00" min="0" step="0.01" data-rule="required" />
        </td>
        <td>
            <input type="number" name="row[specList][<%=index%>][stock]" class="form-control" value="0" min="0" data-rule="required" />
        </td>
        <td>
            <a href="javascript:;" class="btn btn-xs btn-danger btn-delone"><i class="fa fa-times"></i></a>
        </td>
    </tr>
</script>
